package ModelBean;

import java.util.ArrayList;
import java.util.List;

import POJO.Category;

public class NodeCategory {
	public Category value;
	public List<NodeCategory> childs;
	
	public Category getValue() {
		return value;
	}

	public void setValue(Category value) {
		this.value = value;
	}

	public List<NodeCategory> getChilds() {
		return childs;
	}

	public void setChilds(List<NodeCategory> childs) {
		this.childs = childs;
	}

	public NodeCategory(){
		value = null;
		childs = new ArrayList<NodeCategory>();
	}
	
	public NodeCategory(Category category){
		value = category;
		childs = new ArrayList<NodeCategory>();
	}
	
	public NodeCategory(Category category, List<NodeCategory> childs){
		this.value = category;
		this.childs = childs;
	}
	
	public void addChild(NodeCategory node){
		if (childs == null)
			this.childs = new ArrayList<NodeCategory>();
		this.childs.add(node);
	}
	
	public void addChild(Category category){
		NodeCategory n = new NodeCategory(category);
		this.addChild(n);
	}
	
	public boolean hasChild(){
		return childs.size() > 0;
	}
}
